<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
  </head>
  <body>
    <script>
      var obj = {
        name: 'abc',
        age: 123,
        sex: 'female'
      }
      var obj1 = {}
      function clone(origin, target) {
        var target = target || {}
        for (var prop in origin) {
          target[prop] = origin[prop]
        }
        return target
      }
      console.log(clone(obj, obj1)) // {name: 'abc',  age: 123, sex: 'female'}
    </script>
  </body>
</html>
